#import <UIKit/UIKit.h>

#import "framework/FWDBAccess.h"

#import "PITask.h"


extern NSString* const kFieldNameContextStatus;
extern NSString* const kFieldNameChildCount;
extern NSString* const kFieldNameImportance;
extern NSString* const kFieldNameStartDate;
extern NSString* const kFieldNameDueDate;
extern NSString* const kFieldNameTagID;


@class SBApplication;
@class FWApplication;


@interface PITaskIntegration : NSObject <FWDBAccessDelegate>

+ (NSMutableArray*)basicTaskList:(FWApplication*)app database:(FWDatabase*)database prefs:(FWPreferences*)prefs key:(NSString*)key parentKey:(NSString*)parentKey search:(NSString*)search;

+ (void)addAlarmDataToTaskList:(FWApplication*)app database:(FWDatabase*)database tasks:(NSArray*)tasks prefs:(FWPreferences*)prefs;

+ (PITask*)augmentedBasicTask:(PITask*)task database:(FWDatabase*)database application:(FWApplication*)app;

+ (NSInteger)numberOfLocationContexts:(FWApplication *)application;

+ (NSArray*)arrayOfContexts:(FWApplication *)application earliest:(NSDate*)earliest counts:(BOOL)counts;

+ (NSURL*)urlForNewTask:(NSString*)title importance:(enum PIImportanceType)importance application:(FWApplication*)app;

+ (NSURL*)urlForShowTask:(PITask*)task application:(FWApplication*)app;

+ (BOOL)completeTask:(PITask*)task application:(FWApplication*)app;

+ (PITaskIntegration*)implementationForApp:(FWApplication*)app;


- (NSMutableString*)basicTaskListSQL:(FWApplication*)app prefs:(FWPreferences*)prefs contexts:(NSString*)contexts key:(NSString*)key parentKey:(NSString*)parentKey search:(NSString*)search;

- (NSString*)augmentedBasicTaskSQL:(PITask*)task application:(FWApplication*)app;

- (NSString*)addAlarmDataToTaskListSQL:(FWApplication*)app keys:(NSString*)keys prefs:(FWPreferences*)prefs;

- (NSString*)numberOfLocationContextsSQL:(FWApplication *)application;

- (NSString*)arrayOfContextsSQL:(FWApplication *)application earliest:(NSDate*)earliest counts:(BOOL)counts;

- (NSURL*)urlForNewTask:(NSString*)title importance:(enum PIImportanceType)importance application:(FWApplication*)app info:(NSArray*)info;

- (NSString*)infoForNewTaskSQL:(FWApplication*)app;

- (NSString*)completeTaskSQL:(PITask*)task application:(FWApplication*)app;

@end
